<script type="text/javascript">
	Yutil.useLoadingMessage();

	calculateIncometax();
</script>    

<%
	String employeeid = request.getParameter("employeeids");
%>
 
<!-- 个人所得税 -->
<table align="left">
	<tr>
		<th>扣除保险金与公积金后工资</th>
		<td><input id="beforetax_salary" name="beforetax_salary" class="number" value=""/></td>
	</tr>
	<tr>
		<th>个人所得税</th>
		<td><input id="incometax" name="incometax" class="number" value=""/></td>
	</tr>
	<tr>
		<th>税后工资</th>
		<td>
			<input id="aftertax_salary" name="aftertax_salary" class="number"/>
		</td>
	</tr>
 
</table>

<script type="text/javascript">
	//calculate the before tax salary
	$('beforetax_salary').value = Number($('insuranceBase').value) - Number($('insurance_value').value) - Number($('housingfund_value').value);
	
	//calculate the income tax
	//salary * rate - (Quick calculation deduction)
	var salary = Number($('beforetax_salary').value);
	var incometax = 0;
	var taxrate = 0;
	var qcd = 0;
	if(salary < 500) {
		taxrate = 5;
		qcd = 0;
	} else if(salary >=500 && salary < 2000) {
		taxrate = 10;
		qcd = 25;
	} else if(salary >=2000 && salary < 5000) {
		taxrate = 15;
		qcd = 125;
	} else if(salary >=5000 && salary < 20000) {
		taxrate = 20;
		qcd = 375;
	} else if(salary >=20000 && salary < 40000) {
		taxrate = 25;
		qcd = 1375;
	} else if(salary >=40000 && salary < 60000) {
		taxrate = 30;
		qcd = 3375;
	} else if(salary >=60000 && salary < 80000) {
		taxrate = 35;
		qcd = 6375;
	} else if(salary >=80000 && salary < 100000) {
		taxrate = 40;
		qcd = 10375;
	} else if(salary >=80000 && salary < 100000) {
		taxrate = 45;
		qcd = 15375;
	} 
	incometax = salary * taxrate / 100 - qcd;
	$('incometax').value = distract(incometax, 2);
	$('aftertax_salary').value = distract(salary - incometax, 2);
		
</script>    

<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="com.esms.struts.service.*" %>